package nccloud.web.hrpbm.sjxm.sjxmh.action;
import java.util.HashMap;
import java.util.Map;
import nc.pub.billcode.vo.BillCodeContext;
import nccloud.web.codeplatform.framework.action.base.BaseAction;
import nccloud.web.codeplatform.framework.action.base.RequstParamWapper;
import nccloud.web.codeplatform.framework.action.base.RequestDTO;
import nccloud.web.codeplatform.framework.action.base.VOTransform;
import nccloud.framework.service.ServiceLocator;
import nccloud.framework.web.container.IRequest;
import nccloud.framework.core.exception.BusinessException;
import nc.vo.sjxm.sjxm.AggSjxmVO;
import nc.itf.hrpbm.sjxm.sjxmh.ISjxmHVOService;

/**
 * 编辑Action
 */
public class EditSjxmHVOAction extends BaseAction{
	@Override
	public Object doAction(IRequest request, RequstParamWapper paramWapper) throws Throwable{
		//json数据转换
		RequestDTO param = VOTransform.toVO(paramWapper.requestString,RequestDTO.class);
		//获取参数
		String pk = param.getPk();
		
		ISjxmHVOService service = ServiceLocator.find(ISjxmHVOService.class);
		
		AggSjxmVO vo = service.preEditAggSjxmVO(pk);
		
		if(vo == null){
			throw new BusinessException("没有查到对应的数据，请重试");
		}
		Map<String,Object> externalData = new HashMap<>();
		BillCodeContext context = service.getBillCodeContext("sjxmsjxm");
		externalData.put("billCodeContext",context);
		return buildResult(param,true,externalData,vo);
	}
	
}
